class BaseModel(object):
    default_hidden = []

    def to_dict(self, hidden=None, only=None):
        if hidden and only:
            hidden = []
        columns = self.__table__.columns
        data = {c.name: getattr(self, c.name, None) for c in columns}
        if hidden:
            for v in hidden:
                del data[v]
        if only:
            for v in only:
                del data[v]
        if data.get('create_time'):
            data['create_time'] = str(data['create_time'])
        if data.get('delete_time'):
            data['create_time'] = str(data['create_time'])
        return data

    @classmethod
    def to_list(cls, list, hidden=None, only=None):
        data = []
        for obj in list:
            data.append(obj.to_dict(hidden=hidden, only=only))
        return data